package com.cj.mobile.iabp.di.module;

import androidx.recyclerview.widget.GridLayoutManager;

import com.cj.mobile.iabp.app.global.AccountManager;
import com.cj.mobile.iabp.app.global.RequestMapper;
import com.cj.mobile.iabp.mvp.contract.AddRemoveInfoContract;
import com.cj.mobile.iabp.mvp.model.AddRemoveInfoModel;
import com.cj.mobile.iabp.mvp.ui.adapter.UploadCertificateAdapter;
import com.jess.arms.cj.ApiOperator;
import com.jess.arms.cj.IRequestMapper;
import com.jess.arms.di.scope.ActivityScope;

import java.util.ArrayList;
import java.util.List;

import dagger.Binds;
import dagger.Module;
import dagger.Provides;

/**
 * ================================================
 * Description:
 * <p>
 * Created by MVPArmsTemplate on 2025/09/29 16:25
 * <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
 * <a href="https://github.com/JessYanCoding">Follow me</a>
 * <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
 * <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
 * <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
 * ================================================
 */
@Module
//构建AddRemoveInfoModule时,将View的实现类传进来,这样就可以提供View的实现类给presenter
public abstract class AddRemoveInfoModule {

    @Binds
    abstract AddRemoveInfoContract.Model bindAddRemoveInfoModel(AddRemoveInfoModel model);

    @ActivityScope
    @Provides
    static AccountManager provideAccountManager(AddRemoveInfoContract.View view) {
        return new AccountManager(view.getActivity());
    }

    @ActivityScope
    @Provides
    static IRequestMapper providerRequestMapper(AddRemoveInfoContract.View view, AccountManager mAccountManager) {
        return new RequestMapper(view.getActivity(), mAccountManager);
    }

    @ActivityScope
    @Provides
    static ApiOperator providerOperator(IRequestMapper requestMapper) {
        return new ApiOperator(requestMapper);
    }

    @ActivityScope
    @Provides
    static GridLayoutManager provideGridLayoutManager(AddRemoveInfoContract.View view) {
        return new GridLayoutManager(view.getActivity(), 4);
    }

    @ActivityScope
    @Provides
    static List<String> provideInOrderList() {
        return new ArrayList<>();
    }

    @ActivityScope
    @Provides
    static UploadCertificateAdapter provideUploadCertificateAdapter(List<String> list) {
        return new UploadCertificateAdapter(list);
    }
}